import Vue from 'vue'
import vtp from '../assets/libs/js/tipconm'
// import axios from '../axios/index'
// import { setTimeout } from 'core-js'
// Vue.prototype.vtp = vtp
// 全局过滤器

Vue.filter('stringNoTwoAdd', function (value) {
    value = value.toString()
    if (value.length < 2) {
      value = "0" + value;
    }
    return value;
})

Vue.filter('stringNumber', function (value) {
    value = value.toString().length * 50;
    return value;
})
Vue.filter('dataAddMark', function (value,index) {
    
    return  index == 0 ? value : '、'+value;
})
Vue.filter('stringIfReturn', function (value,st1,st2,val = 0) {
    return  value == val ? st1 : st2;
})
Vue.filter('stringGetTime', function (value) {
    if(value){
        let val = value.split(" ")
        value = val[1].split(":")
        return  value[0]+':'+value[1];
    }
    
})
Vue.filter('getTimeVal', function (value) {
    if(value){
        let val = vtp.timeValFun(value);
        // console.log(val);
        // value = val[1].split(":")
        return  (vtp.addZero(val.day*24+val.hours)+ ':'+vtp.addZero(val.minutes)) ;
    }
})
Vue.filter('ifAddRedState', function (value) {
    if(value){
        let val = value.split(":")
        let html = val[0] < 20 ? '0' : '1'
        // console.log(html);
        // value = val[1].split(":")
        return  html ;
    }
    
})
Vue.filter('arrStringToggle', function (value) {
    if(value){
        // let val = value.split(":")
        let html = ''
        value.map((item,i) => {
            html += i == 0 ? value[i] : '、'+value[i]
        });
        // console.log(html);
        // value = val[1].split(":")
        return  html ;
    }
    
})